<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<div class="modal-dialog ms-modal-dialog" >
  <div class="modal-content">

    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
      <h4 class="modal-title">编辑停车场信息</h4>
    </div>
      
    <form class="form-horizontal ms-form modal-search-form" role="form" method="POST" action="${ctx.host}/suppliers/${supplierId}/parking-resource/${parkingResource.id}"
          data-validate="true" data-anchor="#anchor-parking-resource">
      <div class="modal-body">
      
        <input type="hidden" name="_method" value="PATCH" />
        <input type="hidden" name="id" value="${parkingResource.id}" />
        

        <div class="form-horizontal ms-form form-personal-info">
    
          <div class="form-group ms-form-group">
            <label class="control-label col-xs-4 ">1&nbsp;<span class="color-red">*</span>位置：</label>
            <div class="col-xs-7 pull-left">
              <input type="text" name="position" class="form-control" data-validate="required" value="${parkingResource.position }" placeholder="" tabindex="1" autocomplete="off"/>
            </div>
          </div>
          
          <div class="form-group ms-form-group">
            <label class="control-label col-xs-4 ">2&nbsp;<span class="color-red">*</span>面积：</label>
            <div class="col-xs-7 pull-left">
              <input type="text" name="area" class="form-control" data-validate="required" value="${parkingResource.area }" placeholder="" tabindex="1" autocomplete="off"/>
            </div>
          </div>
  
          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-4" >3&nbsp;<span class="color-red">*</span>场地来源：</label>
            <div class="col-xs-7 pull-left">
              <select class="select2 form-control" name="fieldSource"  data-validate="required" tabindex="1">
                 <option></option>
                 <c:forEach var="fieldSource" items="${enums['FieldSource'] }">
                   <option value="${fieldSource}" ${fieldSource eq parkingResource.fieldSource ? 'selected' : ''}>${fieldSource.description}</option>
                 </c:forEach>
             </select>
            </div>
          </div>
          
          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-4">4&nbsp;到期日期：</label>
            <div class="col-xs-7 pull-left">
              <input type="text" name="expireDate" class="form-control date" value="<fmt:formatDate value="${parkingResource.expireDate }" pattern="yyyy-MM-dd"/>" placeholder="" tabindex="1" autocomplete="off"/>
            </div>
          </div>
          
        </div>
      </div>

      <div class="modal-footer">
          <button type="submit" class="btn ms-btn btn-primary">确定</button>
          <button type="button" class="btn ms-btn ms-btn-gary" data-dismiss="modal">取消</button>
      </div>

    </form>
      
  </div>
</div>

<script type="text/javascript">
    $(document).ready(function () {

        $('select[name="fieldSource"]').select2({
            theme: "classic",
            placeholder: '请选择',
            minimumResultsForSearch: -1,
            allowClear: true,
        });
        
        $('.date').datetimepicker({
            format: 'yyyy-mm-dd',
            autoclose: true,
            language: 'zh-CN',
            todayBtn: 'linked',
            startDate: '${today}',
            todayHighlight: true,
            pickerPosition: 'bottom-right',
            minView: 'month'
          });

    })
</script>
